package com.hskj.springboot.controller;

import com.hskj.springboot.bean.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @Value("${name}")
    private String name;

    @Value("${person.name}")
    private String name2;

    @Value("${person.age}")
    private int age;
    @Value("${address[1]}")
    private String address;
    @Value("${msg1}")
    private String msg1;
    @Value("${msg2}")
    private String msg2;
    @Autowired
    private Person person;

    @GetMapping("/hello")
    public String hello(){
        System.out.println(name);
        System.out.println(name2);
        System.out.println(age);
        System.out.println(address);
        System.out.println(msg1);
        System.out.println(msg2);
        System.out.println(person);
        String[] address1 = person.getAddress();
        for (String s : address1) {
            System.out.println(s);
        }

        return "Hello World";
    }
}
